class_name PlayerRollState
extends GameplayState

@onready var player: Player = $"../../../"


func _on_enter() -> void:
	player.animator.play("roll")

	player.player_tag_manager.add_tag(player.player_tag_manager.State_Ground_Crouch)
	player.player_tag_manager.add_tag(player.player_tag_manager.State_Ground_Move_Roll)

	player.velocity.x = player.face_direction * player.player_stats.roll_speed


func _on_update(_delta: float) -> void:
	if not player.animator.is_playing():
		change_state("GhostState", func(): pass)
		return


func _on_exit() -> void:
	player.player_tag_manager.remove_tag(player.player_tag_manager.State_Ground_Crouch)
	player.player_tag_manager.remove_tag(player.player_tag_manager.State_Ground_Move_Roll)
